home *** CD-ROM | disk | FTP | other *** search
- Path: news.central.ntua.gr!not-for-mail
- From: hnick@central.ntua.gr (Nick C. Fotis)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Disk Space Left
- Date: 9 Mar 1996 09:04:09 GMT
- Organization: National Technical University of Athens, Greece
- Message-ID: <4hrhi9$gba@zeus.central.ntua.gr>
- References: <DnL5B6.62u.0.staffin.dcs.ed.ac.uk@dcs.ed.ac.uk> <4henti$hks@btmpjg.god.bel.alcatel.be>
- NNTP-Posting-Host: gate2-zeus.central.ntua.gr
- X-Newsreader: NN version 6.5.0 #1 (NOV)
-
- barnhoorn@nlev00 () writes:
-
-
- >In article <DnL5B6.62u.0.staffin.dcs.ed.ac.uk@dcs.ed.ac.uk>, cdc@dcs.ed.ac.uk (Christopher Carr) writes:
- >> How do you correctly calculate the available disk space
- >>left on any single device. I am referring to the the fact that some
- >>small files take a minimun block size.
- >>
-
- >unsigned long BP_FreeDiskMem(void)
- >{
- > /* this function returns the number of free bytes on the current disk */
-
- > struct InfoData info;
- ^^^^^^^^^^^^^^^^^^^^^
-
- Will only work as long as the above struct (which will be in stack) is
- quaranteed to be longword aligned. I am not sure if thats the rule though
- for all the C compilers out there.
- (Note: If it isn't lonword alligned and it works, then dont blame me....
- blame the Autodocs ;-)
-
- If you want to be Autodocs legal, you should use a pointer and try
- AllocMem (all OSes) or AllocVec (OS>=2.0) or you could even go for the
- AllocDosObject (OS>=1.3) to get space for your struct.
-
- Hey, even malloc returns longword aligned space in all compilers AFAIK :-)
-
- > unsigned long size;
-
- > if (getdfs(0,&info)!=0)
- > return 0;
- > size=(info.id_NumBlocks-info.id_NumBlocksUsed)*info.id_BytesPerBlock;
- > return size;
- >}
-
-
- >--
- >---------------------------------------------------------------------------
- >Jaco Barnhoorn barnie@xs4all.nl
- >Software Test Engineer barnhoorn%nlev00@btmv56.se.bel.alcatel.be
- >Alcatel Telecom Systems
- >Rijswijk, The Netherlands
- >---------------------------------------------------------------------------
- --
-
- +----------------------------------------------------------------------------+
- | Alkinoos Alexandros Argiropoulos A1200, '030@40, 6MB Fast |
- | Athens, Greece "AAA is not a chipset...It's my name" |
- +----------------------------------------------------------------------------+
-